package Jumin_Test;

import java.util.Scanner;

public class JuminMain {
	public static void main(String[] args) {
		
		JuminVO jv = new JuminVO();
		Scanner sc = new Scanner(System.in);
		
			System.out.print("이름을 입력하시오 : ");
			jv.setName(sc.next());
		
		while (true) {
			System.out.print("주민등록 번호를 입력하시오 : ");
			jv.setJuminNo(sc.next());
			if (jv.getJuminNo().length() == 13 && JuminService.checkJumin(jv.getJuminNo())) {
				break;
			}
			 else {
				System.err.println("주민등록 번호를 잘못입력하셨습니다. 다시 입력해주세요");
				}
			}
		
		jv.setBirthday(JuminService.birth(jv.getJuminNo().substring(0, 6), jv.getJuminNo().substring(6, 7)));
		jv.setGender(JuminService.gender(jv.getJuminNo().substring(6, 7)));
		jv.setCountry(JuminService.country(jv.getJuminNo().substring(6, 7)));
		jv.setArea(JuminService.birthArea(jv.getJuminNo().substring(7, 9)));
		jv.setAge(JuminService.checkAge(jv.getJuminNo().substring(0, 6), jv.getJuminNo().substring(6, 7)));
		System.out.println(jv.toString());
	}
	
}
